package com.atstudent.gmall.item.rpc;

import com.atstudent.gmall.common.result.Result;
import com.atstudent.gmall.item.biz.SkuDetailBizService;
import com.atstudent.gmall.product.vo.SkuDetailVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * service-item远程服务接口
 * @Author 薛有朋
 * @CreatDate 2024/12/1 17:48
 **/
@RestController
@RequestMapping(value = "/api/inner/item")
public class SkuDetailController {
    @Autowired
    private SkuDetailBizService skuDetailBizService;

    /**
     * 查询商品详情页数据
     * @Author 薛有朋
     * @Date 2024/12/1 18:02
     **/
    @GetMapping(value = "/item/{skuId}")
    public Result<SkuDetailVo> item(@PathVariable(value = "skuId") Long skuId){
        SkuDetailVo skuDetailVo = skuDetailBizService.item(skuId);
        skuDetailBizService.updateHotScore(skuId);
        return Result.ok(skuDetailVo);
    }


}
